<style>
    @import url('/static/css/UserIndex.css');
</style>
<!-- 用户信息 -->
<div class="user">
    <div class="avatar wow fadeInUp">
        <img src="/{$LoginUser.avatar ? $LoginUser.avatar : '/static/images/avatar.png'}" />
    </div>

    <div class="nickname wow fadeInUp" data-wow-delay="100ms">{$LoginUser.nickname ? $LoginUser.nickname : '请设置昵称'}</div>

    <!-- <a href="UserLogin.html" class="login wow fadeInUp" data-wow-delay="200ms">登录</a> -->
</div>

<!-- 菜单 -->
<div class="menulist wow fadeInUp" data-wow-delay="300ms">
    <a href="{:url('user/profile')}" class="item">
        <span>基本资料</span>
        <img src='/static/images/row.png' />
    </a>
    <a href="javascript:void(0)" class="item" id="logout">
        <span>退出</span>
        <img src='/static/images/row.png' />
    </a>
</div>

{include file='common/tabar'/}


<script>
    $(document).ready(function(){
        $('#logout').click(function(){
            layer.confirm('确认退出？',{
                title:'是否退出账号',
                icon:3
            },(index) => {

                $.ajax({
                    type:'post',
                    url:`{:url('index/logout')}`,
                    dataType:'json',
                    success:(res) => {
                        if(res.code === 1)
                        {
                            layer.msg(res.msg,{
                                icon:6
                            },() => {
                                location.href = `{:url('index/login')}`
                            })
                        }
                    }
                })

                layer.close(index)
            })
        })
    })
</script>